package org.linuxsogood.boot.controller;

import org.linuxsogood.boot.pojo.Person;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author honway.liu
 * @date 2019-07-08 21:23
 * @email gm100861@gmail.com
 * @blog http://linuxsogood.org
 */
@RestController
@RequestMapping("/person")
public class PersonController {

    @RequestMapping(value = "/list", method = RequestMethod.GET)
    @Cacheable()
    public List<Person> listUser() {
        List<Person> result = new ArrayList<>();

        Person p1 = new Person();
        p1.setName("honway");
        p1.setAddress("shanghai");
        p1.setAge(30);
        Person p2 = new Person();
        p2.setName("honway");
        p2.setAddress("shanghai");
        p2.setAge(30);
        result.add(p1);
        result.add(p2);
        return result;
    }
}
